import { IFeidaoAiMobile } from '@dfeidao/atom-mobile/interfaces';
import get from '@dfeidao/atom-mobile/local/get';
import set from '@dfeidao/atom-mobile/local/set';
import nodejs from '@dfeidao/atom-mobile/msg/nodejs';
import show_sheet from '@dfeidao/atom-mobile/msgbox/action-sheet';
import render from '@dfeidao/atom-mobile/render/render';
export default async function a009(fd: IFeidaoAiMobile) {
	// 切换查看班级
	const class_res = get(fd, 'class_res') as [{ class_id: string, class_name: string, grade: string }];
	const options = new Array();
	for (let i = 0; i < class_res.length; i++) {
		const text = class_res[i].grade + '-' + class_res[i].class_name;
		options.push(text);
	}
	options.push('取消');
	const res = await show_sheet({
		options,
		title: '                                           签到班级'
	});
	const class_s = class_res[res];
	if (!class_s) {
		return;
	}
	const params = get(fd, 'params') as { teacher_no: string };
	const d = await nodejs('app-home/s002', {
		params: {
			productid: get(fd, 'productid'),
			teacher_no: params.teacher_no,
			class_id: class_s.class_id,
			class_res
		}
	});
	set(fd, 'vaue', class_s.class_id);
	render(fd, { data: { class_res, d, vaue: class_s.class_id, vaue_name: class_s.class_name } });
}
